<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the MantisProjectVersionTable class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single MantisProjectVersionTable object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a MantisProjectVersionTableMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 *
	 * @package My QCubed Application
	 * @subpackage MetaControls
	 * @property-read MantisProjectVersionTable $MantisProjectVersionTable the actual MantisProjectVersionTable data class being edited
	 * @property QLabel $IdControl
	 * @property-read QLabel $IdLabel
	 * @property QIntegerTextBox $ProjectIdControl
	 * @property-read QLabel $ProjectIdLabel
	 * @property QTextBox $VersionControl
	 * @property-read QLabel $VersionLabel
	 * @property QTextBox $DescriptionControl
	 * @property-read QLabel $DescriptionLabel
	 * @property QIntegerTextBox $ReleasedControl
	 * @property-read QLabel $ReleasedLabel
	 * @property QIntegerTextBox $ObsoleteControl
	 * @property-read QLabel $ObsoleteLabel
	 * @property QIntegerTextBox $DateOrderControl
	 * @property-read QLabel $DateOrderLabel
	 * @property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * @property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class MantisProjectVersionTableMetaControlGen extends QBaseClass {
		// General Variables
		/**
		 * @var MantisProjectVersionTable objMantisProjectVersionTable
		 * @access protected
		 */
		protected $objMantisProjectVersionTable;
		/**
		 * @var QForm|QControl objParentObject
		 * @access protected
		 */
		protected $objParentObject;
		/**
		 * @var string strTitleVerb
		 * @access protected
		 */
		protected $strTitleVerb;
		/**
		 * @var boolean blnEditMode
		 * @access protected
		 */
		protected $blnEditMode;

		// Controls that allow the editing of MantisProjectVersionTable's individual data fields
		/**
		 * @var QLabel lblId
		 * @access protected
		 */
		protected $lblId;
		/**
		 * @var QIntegerTextBox txtProjectId
		 * @access protected
		 */
		protected $txtProjectId;
		/**
		 * @var QTextBox txtVersion
		 * @access protected
		 */
		protected $txtVersion;
		/**
		 * @var QTextBox txtDescription
		 * @access protected
		 */
		protected $txtDescription;
		/**
		 * @var QIntegerTextBox txtReleased
		 * @access protected
		 */
		protected $txtReleased;
		/**
		 * @var QIntegerTextBox txtObsolete
		 * @access protected
		 */
		protected $txtObsolete;
		/**
		 * @var QIntegerTextBox txtDateOrder
		 * @access protected
		 */
		protected $txtDateOrder;

		// Controls that allow the viewing of MantisProjectVersionTable's individual data fields
		/**
		 * @var QLabel lblProjectId
		 * @access protected
		 */
		protected $lblProjectId;
		/**
		 * @var QLabel lblVersion
		 * @access protected
		 */
		protected $lblVersion;
		/**
		 * @var QLabel lblDescription
		 * @access protected
		 */
		protected $lblDescription;
		/**
		 * @var QLabel lblReleased
		 * @access protected
		 */
		protected $lblReleased;
		/**
		 * @var QLabel lblObsolete
		 * @access protected
		 */
		protected $lblObsolete;
		/**
		 * @var QLabel lblDateOrder
		 * @access protected
		 */
		protected $lblDateOrder;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * MantisProjectVersionTableMetaControl to edit a single MantisProjectVersionTable object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single MantisProjectVersionTable object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisProjectVersionTableMetaControl
		 * @param MantisProjectVersionTable $objMantisProjectVersionTable new or existing MantisProjectVersionTable object
		 */
		 public function __construct($objParentObject, MantisProjectVersionTable $objMantisProjectVersionTable) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this MantisProjectVersionTableMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked MantisProjectVersionTable object
			$this->objMantisProjectVersionTable = $objMantisProjectVersionTable;

			// Figure out if we're Editing or Creating New
			if ($this->objMantisProjectVersionTable->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to
		 * edit, or if we are also allowed to create a new one, etc.
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisProjectVersionTableMetaControl
		 * @param integer $intId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing MantisProjectVersionTable object creation - defaults to CreateOrEdit
 		 * @return MantisProjectVersionTableMetaControl
		 */
		public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intId)) {
				$objMantisProjectVersionTable = MantisProjectVersionTable::Load($intId);

				// MantisProjectVersionTable was found -- return it!
				if ($objMantisProjectVersionTable)
					return new MantisProjectVersionTableMetaControl($objParentObject, $objMantisProjectVersionTable);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a MantisProjectVersionTable object with PK arguments: ' . $intId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new MantisProjectVersionTableMetaControl($objParentObject, new MantisProjectVersionTable());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisProjectVersionTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisProjectVersionTable object creation - defaults to CreateOrEdit
		 * @return MantisProjectVersionTableMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::PathInfo(0);
			return MantisProjectVersionTableMetaControl::Create($objParentObject, $intId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisProjectVersionTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisProjectVersionTable object creation - defaults to CreateOrEdit
		 * @return MantisProjectVersionTableMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::QueryString('intId');
			return MantisProjectVersionTableMetaControl::Create($objParentObject, $intId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QLabel lblId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblId_Create($strControlId = null) {
			$this->lblId = new QLabel($this->objParentObject, $strControlId);
			$this->lblId->Name = QApplication::Translate('Id');
			if ($this->blnEditMode)
				$this->lblId->Text = $this->objMantisProjectVersionTable->Id;
			else
				$this->lblId->Text = 'N/A';
			return $this->lblId;
		}

		/**
		 * Create and setup QIntegerTextBox txtProjectId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtProjectId_Create($strControlId = null) {
			$this->txtProjectId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtProjectId->Name = QApplication::Translate('Project Id');
			$this->txtProjectId->Text = $this->objMantisProjectVersionTable->ProjectId;
			$this->txtProjectId->Required = true;
			return $this->txtProjectId;
		}

		/**
		 * Create and setup QLabel lblProjectId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblProjectId_Create($strControlId = null, $strFormat = null) {
			$this->lblProjectId = new QLabel($this->objParentObject, $strControlId);
			$this->lblProjectId->Name = QApplication::Translate('Project Id');
			$this->lblProjectId->Text = $this->objMantisProjectVersionTable->ProjectId;
			$this->lblProjectId->Required = true;
			$this->lblProjectId->Format = $strFormat;
			return $this->lblProjectId;
		}

		/**
		 * Create and setup QTextBox txtVersion
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtVersion_Create($strControlId = null) {
			$this->txtVersion = new QTextBox($this->objParentObject, $strControlId);
			$this->txtVersion->Name = QApplication::Translate('Version');
			$this->txtVersion->Text = $this->objMantisProjectVersionTable->Version;
			$this->txtVersion->Required = true;
			$this->txtVersion->MaxLength = MantisProjectVersionTable::VersionMaxLength;
			return $this->txtVersion;
		}

		/**
		 * Create and setup QLabel lblVersion
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblVersion_Create($strControlId = null) {
			$this->lblVersion = new QLabel($this->objParentObject, $strControlId);
			$this->lblVersion->Name = QApplication::Translate('Version');
			$this->lblVersion->Text = $this->objMantisProjectVersionTable->Version;
			$this->lblVersion->Required = true;
			return $this->lblVersion;
		}

		/**
		 * Create and setup QTextBox txtDescription
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtDescription_Create($strControlId = null) {
			$this->txtDescription = new QTextBox($this->objParentObject, $strControlId);
			$this->txtDescription->Name = QApplication::Translate('Description');
			$this->txtDescription->Text = $this->objMantisProjectVersionTable->Description;
			$this->txtDescription->Required = true;
			$this->txtDescription->TextMode = QTextMode::MultiLine;
			return $this->txtDescription;
		}

		/**
		 * Create and setup QLabel lblDescription
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblDescription_Create($strControlId = null) {
			$this->lblDescription = new QLabel($this->objParentObject, $strControlId);
			$this->lblDescription->Name = QApplication::Translate('Description');
			$this->lblDescription->Text = $this->objMantisProjectVersionTable->Description;
			$this->lblDescription->Required = true;
			return $this->lblDescription;
		}

		/**
		 * Create and setup QIntegerTextBox txtReleased
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtReleased_Create($strControlId = null) {
			$this->txtReleased = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtReleased->Name = QApplication::Translate('Released');
			$this->txtReleased->Text = $this->objMantisProjectVersionTable->Released;
			$this->txtReleased->Required = true;
			return $this->txtReleased;
		}

		/**
		 * Create and setup QLabel lblReleased
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblReleased_Create($strControlId = null, $strFormat = null) {
			$this->lblReleased = new QLabel($this->objParentObject, $strControlId);
			$this->lblReleased->Name = QApplication::Translate('Released');
			$this->lblReleased->Text = $this->objMantisProjectVersionTable->Released;
			$this->lblReleased->Required = true;
			$this->lblReleased->Format = $strFormat;
			return $this->lblReleased;
		}

		/**
		 * Create and setup QIntegerTextBox txtObsolete
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtObsolete_Create($strControlId = null) {
			$this->txtObsolete = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtObsolete->Name = QApplication::Translate('Obsolete');
			$this->txtObsolete->Text = $this->objMantisProjectVersionTable->Obsolete;
			$this->txtObsolete->Required = true;
			return $this->txtObsolete;
		}

		/**
		 * Create and setup QLabel lblObsolete
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblObsolete_Create($strControlId = null, $strFormat = null) {
			$this->lblObsolete = new QLabel($this->objParentObject, $strControlId);
			$this->lblObsolete->Name = QApplication::Translate('Obsolete');
			$this->lblObsolete->Text = $this->objMantisProjectVersionTable->Obsolete;
			$this->lblObsolete->Required = true;
			$this->lblObsolete->Format = $strFormat;
			return $this->lblObsolete;
		}

		/**
		 * Create and setup QIntegerTextBox txtDateOrder
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtDateOrder_Create($strControlId = null) {
			$this->txtDateOrder = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtDateOrder->Name = QApplication::Translate('Date Order');
			$this->txtDateOrder->Text = $this->objMantisProjectVersionTable->DateOrder;
			$this->txtDateOrder->Required = true;
			return $this->txtDateOrder;
		}

		/**
		 * Create and setup QLabel lblDateOrder
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblDateOrder_Create($strControlId = null, $strFormat = null) {
			$this->lblDateOrder = new QLabel($this->objParentObject, $strControlId);
			$this->lblDateOrder->Name = QApplication::Translate('Date Order');
			$this->lblDateOrder->Text = $this->objMantisProjectVersionTable->DateOrder;
			$this->lblDateOrder->Required = true;
			$this->lblDateOrder->Format = $strFormat;
			return $this->lblDateOrder;
		}



		/**
		 * Refresh this MetaControl with Data from the local MantisProjectVersionTable object.
		 * @param boolean $blnReload reload MantisProjectVersionTable from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objMantisProjectVersionTable->Reload();

			if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objMantisProjectVersionTable->Id;

			if ($this->txtProjectId) $this->txtProjectId->Text = $this->objMantisProjectVersionTable->ProjectId;
			if ($this->lblProjectId) $this->lblProjectId->Text = $this->objMantisProjectVersionTable->ProjectId;

			if ($this->txtVersion) $this->txtVersion->Text = $this->objMantisProjectVersionTable->Version;
			if ($this->lblVersion) $this->lblVersion->Text = $this->objMantisProjectVersionTable->Version;

			if ($this->txtDescription) $this->txtDescription->Text = $this->objMantisProjectVersionTable->Description;
			if ($this->lblDescription) $this->lblDescription->Text = $this->objMantisProjectVersionTable->Description;

			if ($this->txtReleased) $this->txtReleased->Text = $this->objMantisProjectVersionTable->Released;
			if ($this->lblReleased) $this->lblReleased->Text = $this->objMantisProjectVersionTable->Released;

			if ($this->txtObsolete) $this->txtObsolete->Text = $this->objMantisProjectVersionTable->Obsolete;
			if ($this->lblObsolete) $this->lblObsolete->Text = $this->objMantisProjectVersionTable->Obsolete;

			if ($this->txtDateOrder) $this->txtDateOrder->Text = $this->objMantisProjectVersionTable->DateOrder;
			if ($this->lblDateOrder) $this->lblDateOrder->Text = $this->objMantisProjectVersionTable->DateOrder;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC MANTISPROJECTVERSIONTABLE OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's MantisProjectVersionTable instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveMantisProjectVersionTable() {
			try {
				// Update any fields for controls that have been created
				if ($this->txtProjectId) $this->objMantisProjectVersionTable->ProjectId = $this->txtProjectId->Text;
				if ($this->txtVersion) $this->objMantisProjectVersionTable->Version = $this->txtVersion->Text;
				if ($this->txtDescription) $this->objMantisProjectVersionTable->Description = $this->txtDescription->Text;
				if ($this->txtReleased) $this->objMantisProjectVersionTable->Released = $this->txtReleased->Text;
				if ($this->txtObsolete) $this->objMantisProjectVersionTable->Obsolete = $this->txtObsolete->Text;
				if ($this->txtDateOrder) $this->objMantisProjectVersionTable->DateOrder = $this->txtDateOrder->Text;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the MantisProjectVersionTable object
				$this->objMantisProjectVersionTable->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's MantisProjectVersionTable instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteMantisProjectVersionTable() {
			$this->objMantisProjectVersionTable->Delete();
		}



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'MantisProjectVersionTable': return $this->objMantisProjectVersionTable;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to MantisProjectVersionTable fields -- will be created dynamically if not yet created
				case 'IdControl':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'IdLabel':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'ProjectIdControl':
					if (!$this->txtProjectId) return $this->txtProjectId_Create();
					return $this->txtProjectId;
				case 'ProjectIdLabel':
					if (!$this->lblProjectId) return $this->lblProjectId_Create();
					return $this->lblProjectId;
				case 'VersionControl':
					if (!$this->txtVersion) return $this->txtVersion_Create();
					return $this->txtVersion;
				case 'VersionLabel':
					if (!$this->lblVersion) return $this->lblVersion_Create();
					return $this->lblVersion;
				case 'DescriptionControl':
					if (!$this->txtDescription) return $this->txtDescription_Create();
					return $this->txtDescription;
				case 'DescriptionLabel':
					if (!$this->lblDescription) return $this->lblDescription_Create();
					return $this->lblDescription;
				case 'ReleasedControl':
					if (!$this->txtReleased) return $this->txtReleased_Create();
					return $this->txtReleased;
				case 'ReleasedLabel':
					if (!$this->lblReleased) return $this->lblReleased_Create();
					return $this->lblReleased;
				case 'ObsoleteControl':
					if (!$this->txtObsolete) return $this->txtObsolete_Create();
					return $this->txtObsolete;
				case 'ObsoleteLabel':
					if (!$this->lblObsolete) return $this->lblObsolete_Create();
					return $this->lblObsolete;
				case 'DateOrderControl':
					if (!$this->txtDateOrder) return $this->txtDateOrder_Create();
					return $this->txtDateOrder;
				case 'DateOrderLabel':
					if (!$this->lblDateOrder) return $this->lblDateOrder_Create();
					return $this->lblDateOrder;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to MantisProjectVersionTable fields
					case 'IdControl':
						return ($this->lblId = QType::Cast($mixValue, 'QControl'));
					case 'ProjectIdControl':
						return ($this->txtProjectId = QType::Cast($mixValue, 'QControl'));
					case 'VersionControl':
						return ($this->txtVersion = QType::Cast($mixValue, 'QControl'));
					case 'DescriptionControl':
						return ($this->txtDescription = QType::Cast($mixValue, 'QControl'));
					case 'ReleasedControl':
						return ($this->txtReleased = QType::Cast($mixValue, 'QControl'));
					case 'ObsoleteControl':
						return ($this->txtObsolete = QType::Cast($mixValue, 'QControl'));
					case 'DateOrderControl':
						return ($this->txtDateOrder = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>